﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace EuphoricEngine3D.Helpers
{
    public static class GraphicsHelper
    {
        // Creates a RenderTarget2D with the specified parameters
        public static RenderTarget2D CreateRenderTarget(GraphicsDevice graphicsDevice)
        {
            return CreateRenderTarget(graphicsDevice, graphicsDevice.Viewport.Width,
                graphicsDevice.Viewport.Height);
        }

        // Creates a RenderTarget2D with the specified parameters
        public static RenderTarget2D CreateRenderTarget(GraphicsDevice graphicsDevice, int Width, int Height)
        {
            return CreateRenderTarget(graphicsDevice, Width, Height,
                graphicsDevice.DisplayMode.Format);
        }

        // Creates a RenderTarget2D with the specified parameters
        public static RenderTarget2D CreateRenderTarget(GraphicsDevice graphicsDevice, int Width, int Height,
            SurfaceFormat Format)
        {
            return CreateRenderTarget(graphicsDevice, Width, Height, Format,
                graphicsDevice.PresentationParameters.MultiSampleQuality,
                graphicsDevice.PresentationParameters.MultiSampleType);
        }

        // Creates a RenderTarget2D with the specified parameters
        public static RenderTarget2D CreateRenderTarget
            (GraphicsDevice graphicsDevice, int Width, int Height, SurfaceFormat Format, int MultiSampleQuality, MultiSampleType SampleType)
        {
            return new RenderTarget2D(graphicsDevice, Width, Height, 1, Format, SampleType, MultiSampleQuality, RenderTargetUsage.DiscardContents);
        }

        // Creates a ResolveTexture2D
        public static ResolveTexture2D CreateResolveTexture(GraphicsDevice graphicsDevice)
        {
            return new ResolveTexture2D(graphicsDevice,
                graphicsDevice.Viewport.Width,
                graphicsDevice.Viewport.Height, 1,
                graphicsDevice.DisplayMode.Format);
        }
    }
}